package com.allo2o.common.lepayEnum;

import org.apache.commons.lang.StringUtils;

/**
 * <ul>
 * 用户身份类型
 * </ul>
 * Created by lubingbing on 16-5-4.
 */
public enum MerchantUserTypeEnum {
    CERTIFIED_MERCHANT_USER("0", "已认证用户"),
    MERCHANT_CASHIER_USER("1", "收银员"),
    NONCERTIFIED_MERCHANT_USER("2", "未认证用户"),
    CERTFAILED_MERCHANT_USER("3", "认证失败用户"),
    UNDER_REVIEW_USER("4", "认证中...");

    private String code;
    private String desc;

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    MerchantUserTypeEnum(String code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static MerchantUserTypeEnum getEnumByCode(String code) {
        if (StringUtils.isBlank(code)) {
            return null;
        }
        MerchantUserTypeEnum[] arr = MerchantUserTypeEnum.values();
        for (int i = 0; i < arr.length; i++) {
            if (arr[i].getCode().equalsIgnoreCase(code)) {
                return arr[i];
            }
        }
        return null;
    }

}
